package edu.jd.movieplatform.info.screen;

import edu.jd.movieplatform.common.Result;
import edu.jd.movieplatform.info.movie.Movie;
import edu.jd.movieplatform.info.movie.MovieDto;
import edu.jd.movieplatform.info.movie.MovieService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/info/screen")
public class ScreenAPI {

    @Resource
    private ScreenService screenService;


    @RequestMapping("/screen-list")
    public Result screenList(ScreenDto dto){

        List<Screen> screenList = screenService.getScreenList(dto);
        return Result.success(screenList);

    }

    @RequestMapping("/screen-list-byid")
    public Result screenList(Integer mov_id, Integer cnm_id){

        ScreenDto dto = new ScreenDto();
        dto.setMov_id(mov_id);
        dto.setCnm_id(cnm_id);

        List<Screen> screenList = screenService.getScreenList(dto);
        return Result.success(screenList);

    }

    @RequestMapping("/screen-minprice")
    public Result minPrice(Integer mov_id,Integer cnm_id){

        ScreenDto dto = new ScreenDto();
        dto.setMov_id(mov_id);
        dto.setCnm_id(cnm_id);
        Float minprice = screenService.getScreenMinPrice(dto);

        return Result.success(minprice);

    }


}
